  var lastsel2=0;   
	$(function(){   
		$('#grid').jqGrid({   
			height:400,   
			url:'product_json.jsp',   
			datatype: 'json',   
			mtype: 'POST',   
			colNames:['ID','产品名称','生产日期','单价','数量'],   
			colModel :[   
			{   
				name:'productId',   
				index:'productId',   
				width:50   
			},   
			{   
				name:'productName',   
				index:'productName',   
				editable:true,   
				editrules:{   
					required:true  
				}   
			},   
			{   
				name:'productDate',   
				index:'productDate',   
				editable:true,   
				hidden:true,   
				editoptions:{   
					size:20   
				},   
				editrules:{   
					edithidden:true  
				}   
			},   
			{   
				name:'price',   
				index:'price',   
				align:'right',   
				editable:true,   
				editrules:{   
					required:true  
				}   
			},   
			{   
				name:'quantity',   
				index:'quantity',   
				align:'right',   
				editable:true,   
				editrules:{   
					required:true  
				}   
			} ],   
			pager: 'nav',   
			rowNum:10,   
			rowList:[10,20,30],   
			sortname: 'productId',   
			sortorder: "desc",   
			viewrecords: true,   
			imgpath: contextPath+'/scripts/jqgrid/themes/basic/images',   
			caption: '产品信息',   
			multiselect:true,   
			editurl:''  
		});   
	  
		//定义按键   
		$('#grid').navGrid('#nav',{   
			refresh: true,   
			edit: true,   
			add: true,   
			del: true,   
			search: true  
		});   
	  
	}); 
